<template>
  <div id="renqi">
    <div class="box">
      <div class="box1">
        <span class="q1" @click="ren">人气推荐</span><span class="q2">&gt;</span>
      </div>
      <div class="box2">
        <ul>
          <li v-for="(item, index) in list" :key="index" v-show="index > 0" @click="pao(item.id)">
            <img :src="item.pic" alt="" />
            <p v-html="item.name"></p>
            <p class="aa">{{item.characteristic}}</p>
            <p class="bb">￥{{item.minPrice}}</p>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import { getshop } from "../utils/api";
export default {
  name: "",
  data() {
    return {
      list: [],
    };
  },
  created() {
    getshop().then((res) => {
     
      this.list = Object.values(res);
    });
  },
  methods: {
    ren(){
      this.$router.push('/renqituijian')
    },
    pao(id){
      this.$router.push({
        path:'/xiang',
        query:{
          id
        }
      })
    }
  },
};
</script>

<style lang='scss' scoped>
.box {
  width: 100%;
  height: 640px;

  .box1 {
    width: 100%;
    height: 50px;

    line-height: 50px;
    text-align: center;
    .q1 {
      font-size: 18px;
    }
    .q2 {
      margin-left: 10px;
      font-size: 18px;
    }
  }
  ul {
    width: 100%;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    li {
      width: 46%;
      height: 275px;
    //   background-color: red;
      img {
        width: 100%;
        height: 190px;
      }
      p {
        width: 100%;
        white-space: nowrap;
        overflow: hidden;

        text-overflow: ellipsis;
      }
      .aa{
          font-size: 14px;
          margin-top: 10px;
          color: #cccc;
      }
      .bb{
          font-size: 14px;
          margin-top: 10px;
          color: red;
      }
    }
  }
}
</style>